<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
  exclude-result-prefixes="msxsl"
  version="1.0">
<xsl:import href="../Common/meta.xsl"/>
<xsl:output method="html" 
	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" 
	doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
<xsl:param name="lang" select="'chi'"/>
<xsl:param name="gallery" select="'DC-Circuits'"/>
<xsl:param name="moreinfo_item" select="''"/>
<xsl:variable name="headers" select="document(/exhibits/header/@href)//header[@lang=$lang]"/>
<xsl:variable name="g" select="/exhibits/items[@gallery=$gallery]" />
<xsl:template match = "/">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <xsl:call-template name="content-lang" />
    <title>
      <xsl:call-template name="title" />
    </title>
    <link rel="stylesheet" type="text/css" media="screen" href="/css/default.css" />
    <link rel="stylesheet" type="text/css" media="print" href="/css/print.css" />
    <script type="text/javascript" src="/js/lib/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="/js/lib/hoverIntent.js"></script>
    <script type="text/javascript" src="/js/lib/superfish.js"></script>
    <script type="text/javascript" src="/js/lib/jquery.cycle.all.min.js"></script>
    <script type="text/javascript" src="/js/lib/swfobject-1.5.js"></script>
    <script type="text/javascript" src="/js/theme.js"></script>
  </head>
  <body>
    <div id="exhibits">
    <!--<xsl:call-template name="showheader" />-->
    <xsl:choose>
      <xsl:when test="$moreinfo_item=''">
        <xsl:apply-templates select="$g" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:copy-of select="/exhibits//item[@id=$moreinfo_item]/moreinfo[@lang=$lang]/*|
        /exhibits//item[@id=$moreinfo_item]/moreinfo[@lang=$lang]/text()" />
        <xsl:if test="/exhibits//item[@id=$moreinfo_item]/link[@lang=$lang]/item">
          <h3>
            <xsl:value-of select="$headers/links" />
          </h3>
          <ul>
            <xsl:for-each select="/exhibits//item[@id=$moreinfo_item]/link[@lang=$lang]">
              <li>
                <a target="_blank" href="{@href}">
                  <xsl:value-of select="item" />
                </a>
                <xsl:if test="description!=''">
                  - <xsl:value-of select="description" />
                </xsl:if>
              </li>
            </xsl:for-each>
          </ul>
        </xsl:if>
        <a href="../{/exhibits/items[item[@id=$moreinfo_item]]/@gallery}.html">
          <xsl:value-of select="/exhibits/items[item[@id=$moreinfo_item]]/header[@lang=$lang]" />
        </a>
      </xsl:otherwise>
    </xsl:choose>
    <xsl:call-template name="showfooter" />
    </div>
  </body>
</html>
</xsl:template>

<xsl:template name="title">
  <xsl:choose>
    <xsl:when test="$moreinfo_item = ''">
      <xsl:value-of select="$g/header[@lang=$lang]"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="/exhibits/items/item[@id=$moreinfo_item]/name[@lang=$lang]" />
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>  
  
<xsl:template name="showheader">
  <h1>
   <xsl:choose>
    <xsl:when test="$moreinfo_item = ''">
      <xsl:value-of select="$g/header[@lang=$lang]"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="/exhibits//item[@id=$moreinfo_item]/name[@lang=$lang]" />
    </xsl:otherwise>
   </xsl:choose>  
  </h1>
</xsl:template>

<xsl:template name="showfooter">
  <xsl:if test="$moreinfo_item='' and $g/video/@href!=''">
     <div id="player"><a href="http://www.adobe.com/products/flashplayer/">Get Flash Player</a></div>
     <script type="text/javascript">
	      var so = new SWFObject('http://macao.communications.museum/video/flvplayer.swf','player','176','144','7');
	      so.addParam("allowfullscreen","false");
        so.addVariable("displayheight","164");
        so.addVariable("width","176");
        so.addVariable("height","144");
	      so.addVariable("file",'http://macao.communications.museum/video/<xsl:value-of select="$g/video/@href"/>');
	      so.addVariable("autostart","true");
        so.write('player');
     </script>
  </xsl:if>
</xsl:template>

<xsl:template match="items">
     <xsl:for-each select="item">
        <table class="exhibit" width="auto">
         <tr>
         <td valign="top">
         <xsl:if test="name[@lang=$lang]!=$g/header[@lang=$lang]">
            <span class="exhibit_title">
             <xsl:value-of select="name[@lang=$lang]" />
            </span>
          </xsl:if>
	  
          <xsl:copy-of select="description[@lang=$lang]/*|description[@lang=$lang]/text()" />
          <xsl:if test="moreinfo/@href">
            <a class="link_exhibit" href="MoreInfo/{moreinfo/@href}" target="_parent">
              <xsl:value-of select="$headers/moreInfo" />
            </a>
          </xsl:if>
          <xsl:if test="moreinfo[@lang=$lang]">
            <a class="link_exhibit" href="MoreInfo/{@id}.html" target="_parent">
              <xsl:value-of select="$headers/moreInfo" />
            </a>
          </xsl:if>
          <xsl:if test="info/@href">
          <nobr>
            <a class="link_exhibit" href="/pdf/exhibits/{info/@href}" target="_parent">
              <xsl:value-of select="$headers/moreInfo" />
            </a>
          </nobr>
          </xsl:if>
         </td>
         <td valign="top">
          <img src="/images/exhibits/small/{img/@href}" width="{img/@width}" border="0" align="top"/>
         </td>
         </tr>
        </table>
      <hr />
     </xsl:for-each>
</xsl:template>

</xsl:stylesheet>
